<?php $this->Html->addCrumb('Resources'); ?>
<div class="actions">
	<h3><?php echo __('Actions'); ?></h3>
	<ul>
		<li><?php echo $this->Html->link($this->Html->image('buttons/add-button-50px.png', array(
															'alt'=>'Add',
																)
															), array('action' => 'add'), array('data-toggle' => 'modal', 'data-target' => '#addModal', 'escape'=>false)); ?>
		</li>
	</ul>
</div>
<div class="modal fade hide" id="addModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-header">
			<button type="button" class="close" data-dismiss="modal" aria-hidden="true">X</button>
			<h3 id="myModalLabel">New Resource</h3>
		</div>
		<div class="modal-body">
        <p style="text-align:center;"><img src="img/loading.gif" id="loading-indicator" /><br />Loading Please Wait</p>
		</div>
</div>
<div class="resourcesIndex">
	<h2><?php echo __('Resources'); ?></h2>
	<table cellpadding="0" cellspacing="0">
	<tr>
			<th><?php echo $this->Paginator->sort('resource_title'); ?></th>
			<th><?php echo $this->Paginator->sort('resource_category', 'Category Description'); ?></th>
			<th><?php echo 'Resource Link'; ?></th>
			<th><?php echo $this->Paginator->sort('resource_date', 'Resource Date'); ?></th>
			<th class="actions"><?php echo __('Actions'); ?></th>
	</tr>
	<?php foreach ($resources as $resource): ?>
	<tr>
		<td><?php echo h($resource['Resource']['resource_title']); ?>&nbsp;</td>
		<td><?php echo h($resource['ResourceCategory']['category_desc']); ?>&nbsp;</td>
		<td><?php echo $this->Html->link(__('Link'), '/'.h($resource['Resource']['resource_link'])); ?>&nbsp;</td>
		<td><?php echo date('d-m-Y', strtotime(h($resource['Resource']['resource_date']))); ?>&nbsp;</td>
		<td class="actions">
			<?php echo $this->Html->image('buttons/view-button-35px.png', array(
															'alt'=>'View',
															'url'=> array(
																	'action' => 'view',
																	$resource['Resource']['resource_id']
																	)
																)
															); ?>
			<?php echo $this->Html->image('buttons/edit-button-35px.png', array(
															'alt'=>'Edit',
															'url'=> array(
																	'action' => 'edit',
																	$resource['Resource']['resource_id']
																	)
																)
															); ?>
			<?php echo $this->Form->postLink(
							$this->Html->image('buttons/delete-button-35px.png',array(
																'alt'=>'Delete')
															),
															array(
															'action' => 'delete',
															$resource['Resource']['resource_id']),
															array(
															'escape' => false,
															'confirm' => 'Are you sure you want to delete this resource?', $resource['Resource']['resource_id'])
															); ?>
		</td>
	</tr>
<?php endforeach; ?>
	</table>
	<p>
	<?php
	echo $this->Paginator->counter(array(
	'format' => __('Page {:page} of {:pages}')
	));
	?>	</p>
	<div class="paging">
	<?php
		echo $this->Paginator->prev('< ' . __('Previous '), array(), null, array('class' => 'prev disabled'));
		echo $this->Paginator->numbers(array('separator' => ''));
		echo $this->Paginator->next(__('Next') . ' >', array(), null, array('class' => 'next disabled'));
	?>
	</div>
</div>
